Skip to content

Conversation

@liwilliam2021
Copy link
Contributor

@liwilliam2021 liwilliam2021 commented Aug 2, 2025

Like the background edits, added an experimental setting that does not switch terminals when Roo runs a command.


Important

Introduces preventTerminalDisruption experiment to allow background command execution without terminal focus disruption, with tests and localization updates.

  • Behavior:
    • Adds preventTerminalDisruption experiment to prevent terminal focus disruption during command execution.
    • In executeCommandTool.ts, checks if preventTerminalDisruption is enabled to decide whether to show the terminal.
  • Tests:
    • Adds unit tests in executeCommand.spec.ts to verify terminal behavior with preventTerminalDisruption enabled and disabled.
    • Adds integration test in executeCommandTool.preventTerminalDisruption.integration.spec.ts to ensure correct experiment handling.
  • Localization:
    • Updates localization files to include PREVENT_TERMINAL_DISRUPTION descriptions in multiple languages.

This description was created by Ellipsis for 013fdc7. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 2, 2025
@liwilliam2021 liwilliam2021 changed the title Background commands feat: Background commands Aug 2, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and the implementation looks solid overall. The background terminal execution feature is well-integrated with the existing experimental features system and includes comprehensive localization support. I've left some suggestions inline to improve error handling and test coverage.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 2, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

This seems to achieve a similar effect to disabling terminal integration. However, when terminal integration is disabled, the terminal loses some capabilities and becomes "dumb". Certain commands that rely on updating the terminal state, like some watch commands, no longer work. This approach appears to bypass that limitation.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 2, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Aug 2, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 2, 2025
@mrubens
Copy link
Collaborator

mrubens commented Aug 17, 2025

Should this be in experimental or just added to the terminal settings?

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap Aug 18, 2025
@hannesrudolph hannesrudolph moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@hannesrudolph
Copy link
Collaborator

Should this be in experimental or just added to the terminal settings?

Added to terminal settings.

@hannesrudolph
Copy link
Collaborator

@roomote-agent please run merge resolver

@roomote
Copy link
Contributor

roomote bot commented Sep 23, 2025

Hi @hannesrudolph! I see the merge conflicts on this PR. I'm starting to resolve them now. I'll check out the branch, analyze the conflicts, and push the resolution shortly.

…sruption experiment with existing experiments
@roomote roomote bot force-pushed the will/terminal-focus branch from e01ac26 to 013fdc7 Compare September 23, 2025 04:15
@roomote
Copy link
Contributor

roomote bot commented Sep 23, 2025

Merge conflicts resolved successfully!

Resolution Summary

I've successfully resolved the merge conflicts for PR #6587. The conflicts were in the experiment configuration files where both the main branch and this PR were adding new experiments.

Files resolved (4 conflicts):

  • packages/types/src/experiment.ts - Combined both sets of experiments
  • src/shared/experiments.ts - Merged experiment configurations
  • src/shared/__tests__/experiments.spec.ts - Updated test cases with all experiments
  • webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx - Merged test expectations

Resolution strategy:

The main branch had added imageGeneration, runSlashCommand, and newTaskRequireTodos experiments, while this PR adds preventTerminalDisruption and assistantMessageParser. I combined all experiments from both branches to preserve all functionality.

Status:

  • ✅ All conflicts resolved
  • ✅ Code compiled successfully
  • ✅ Linting passed
  • ✅ Type checking passed
  • ✅ Changes pushed to branch
  • 🔄 CI checks are running

The PR is now ready for review once all CI checks pass.

},
"PREVENT_TERMINAL_DISRUPTION": {
"name": "Esecuzione del terminale in background",
"description": "Previene l'interruzione del focus del terminal quando abilitato. I comandi vengono eseguiti in background senza passare automaticamente ai terminal di output. Puoi continuare a lavorare nel tuo terminal corrente mentre Roo esegue comandi, mantenendo il tuo contesto terminal e controllando manualmente quando visualizzare gli output dei comandi."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typographical suggestion: In 'Previene l'interruzione del focus del terminal quando abilitato. I comandi vengono eseguiti in background senza passare automaticamente ai terminal di output.', consider using 'terminale' instead of 'terminal' for consistency with Italian, and if referring to multiple output terminals, 'ai terminali di output' might be more appropriate.

Suggested change
"description": "Previene l'interruzione del focus del terminal quando abilitato. I comandi vengono eseguiti in background senza passare automaticamente ai terminal di output. Puoi continuare a lavorare nel tuo terminal corrente mentre Roo esegue comandi, mantenendo il tuo contesto terminal e controllando manualmente quando visualizzare gli output dei comandi."
"description": "Previene l'interruzione del focus del terminale quando abilitato. I comandi vengono eseguiti in background senza passare automaticamente ai terminali di output. Puoi continuare a lavorare nel tuo terminale corrente mentre Roo esegue comandi, mantenendo il tuo contesto terminale e controllando manualmente quando visualizzare gli output dei comandi."

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found issues that need attention.

// Check if PREVENT_TERMINAL_DISRUPTION is enabled
// This experimental feature allows commands to run in the background without
// automatically switching focus to the terminal output, improving workflow continuity
const provider = task.providerRef.deref()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: you already read provider state in executeCommandTool earlier. You can pass a precomputed flag (e.g., preventTerminalDisruptionEnabled) into executeCommand(...) and avoid this additional getState() call. This eliminates an extra await and state drift between askApproval and execution. Also consider capturing telemetry when focus is suppressed.

)

// Only show terminal if PREVENT_TERMINAL_DISRUPTION is not enabled
if (!preventTerminalDisruption) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an escape hatch to the options to explicitly force terminal focus when needed, e.g. forceShowTerminal?: boolean. Then honor it in the show logic. This prevents hidden terminals from breaking interactive flows (auth prompts, TUIs).

})
})

describe("PREVENT_TERMINAL_DISRUPTION experiment", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test that simulates an interactive command when preventTerminalDisruption is enabled to ensure the output -> ask() flow still proceeds and does not strand waiting for user input while the terminal is hidden. For example, emulate a prompt line in onLine and verify the tool requests feedback and continues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: PR [Changes Requested]

Development

Successfully merging this pull request may close these issues.

6 participants